Windows Process Memory

I'm looking for a way to get the current memory for a windows process (specifically doors.exe). The vba equivalent of the dxl script I'm looking for is:

    Sub getDoorsMem()
    Dim sApp As String: sApp = "doors.exe"
        Dim oTask As Object
        Dim dMem As Double
        For Each oTask In GetObject("winmgmts:").ExecQuery("Select WorkingSetSize from Win32_Process Where Name = '" & sApp & "'")
            dMem = oTask.WorkingSetSize
            Debug.Print dMem / 1024 / 1024 & "MB"
        Next
    End Sub

I was also thinking it cold be done with WSHshell.


tlhIngan - Wed Jun 25 17:51:44 EDT 2014

Re: Windows Process Memory
Wolfgang Uhr - Thu Jun 26 02:14:49 EDT 2014

Hi

First you should be aware, that doors itself does only perform a relative small part of ole Support.

In VBA you know GetObject and CreateObject. I do not understand why you start with GetObject, but ok. You think, that this object allready exists.

Then you start

OleObject objWmi = oleGetAutoObject("winmgmts:"):

Otherwise you should use oleCreateAutoObject.

Both routines are not an exact dxl replication of GetObject and CreateObject.

The you have the objWmi. To run the routine "ExecQuery" you shall use oleMethod.

The for each loop, you can forget. In this case you have to read the "count" property with oleGet and so on.

Best regards

Wolfgang

 

 

Re: Windows Process Memory
SudarshanRao - Thu Jun 26 04:19:21 EDT 2014

You may want to take a look at the following thread:
https://www.ibm.com/developerworks/community/forums/html/topic?id=c5d4cc33-9986-463e-a73b-36523e6add7a&ps=25

Also, the perm getMemoryUsage gives you an approximate value of memory consumption by the current instance of doors.exe (value is in KB):
print getMemoryUsage()

Re: Windows Process Memory
Wolfgang Uhr - Thu Jun 26 05:30:14 EDT 2014

SudarshanRao - Thu Jun 26 04:19:21 EDT 2014

You may want to take a look at the following thread:
https://www.ibm.com/developerworks/community/forums/html/topic?id=c5d4cc33-9986-463e-a73b-36523e6add7a&ps=25

Also, the perm getMemoryUsage gives you an approximate value of memory consumption by the current instance of doors.exe (value is in KB):
print getMemoryUsage()

Hell Sudarshan

This are different problems. The WMI can only help in the management outside of doorsThat means: Here you can manage the total ressources you need to manage doors. It is something more specifc as the information you simply get from the taskmanager, but this is it.

The link you have posted, dicusses the doors internal situation. For example each dxl-script of its own gets his specific subset of ressources. And then you can get a crash in different ways.

For example you can create strings as much as possible until doors crashes. That does not mean, that you cannot terminate the script after doing 80% of its job and start a new script which opens modules and so on. There are different sets off ressources and so there are different reasons for a crash.

If you want to geht some info about the ressources, which are allready used by all different tasks and jobs, you have to get into the undocumented doors underworld.

If have had a script, that crashes at a specific point and getMemoryUsage could not help me in any way.

Best regards

Wolfgang

 

Re: Windows Process Memory
tlhIngan - Thu Jun 26 14:51:14 EDT 2014

SudarshanRao - Thu Jun 26 04:19:21 EDT 2014

You may want to take a look at the following thread:
https://www.ibm.com/developerworks/community/forums/html/topic?id=c5d4cc33-9986-463e-a73b-36523e6add7a&ps=25

Also, the perm getMemoryUsage gives you an approximate value of memory consumption by the current instance of doors.exe (value is in KB):
print getMemoryUsage()

I got what I needed with the help of SudarhanRao's post. Although getMemoryUsage() appears to return the value in MB not KB. I don't understand exacly what getMemoryUsage() returns. It does not exactly match the task manager but seems to be close enough for a rough idea. It tended to report a lower number than task manager. I would guess 10 to 15 percent less.

I plan to investigate WolfgangUhr idea at a later date.

Thanks for the tips.